package com.lan.parse;

import com.lan.ScriptContext;
import com.lan.antlr.ScriptBaseListener;
import com.lan.antlr.ScriptParser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.apache.commons.lang3.StringUtils;

public class TestScriptBaseListener extends ScriptBaseListener {

    private ScriptContext context;

    public TestScriptBaseListener(ScriptContext context) {
        this.context = context;
    }

    private void print(ParserRuleContext ctx, String name) {
        System.out.println(ctx.getRuleIndex() + " :   " + ctx.toString() + "   " + (StringUtils.isNotBlank(name) ? name : "") + " " + (StringUtils.isNotBlank(ctx.getText()) ? ctx.getText() : ""));
    }


    @Override
    public void enterProg(ScriptParser.ProgContext ctx) {
        print(ctx, "enterProg");
    }

    @Override
    public void enterBlockStatements(ScriptParser.BlockStatementsContext ctx) {
        print(ctx, "enterBlockStatements");
    }

    @Override
    public void enterBlock(ScriptParser.BlockContext ctx) {
        print(ctx, "enterBlock");
    }


    @Override
    public void enterBlockStatement(ScriptParser.BlockStatementContext ctx) {
        print(ctx, "enterBlockStatement");
    }


    @Override
    public void enterClassDeclaration(ScriptParser.ClassDeclarationContext ctx) {
        print(ctx, "enterClassDeclaration");
    }

    @Override
    public void enterClassBody(ScriptParser.ClassBodyContext ctx) {
        print(ctx, "enterClassBody");
    }

    @Override
    public void enterClassBodyDeclaration(ScriptParser.ClassBodyDeclarationContext ctx) {
        print(ctx, "enterClassBodyDeclaration");
    }


    @Override
    public void enterFunctionDeclaration(ScriptParser.FunctionDeclarationContext ctx) {
        print(ctx, "enterFunctionDeclaration");
    }

    @Override
    public void enterFunctionBody(ScriptParser.FunctionBodyContext ctx) {
        print(ctx, "enterFunctionBody");
    }


    @Override
    public void enterFormalParameters(ScriptParser.FormalParametersContext ctx) {
        print(ctx, "enterFormalParameters");
    }


    @Override
    public void enterFieldDeclaration(ScriptParser.FieldDeclarationContext ctx) {
        print(ctx, "enterFieldDeclaration");
    }

    @Override
    public void enterVariableDeclarators(ScriptParser.VariableDeclaratorsContext ctx) {
        print(ctx, "enterVariableDeclarators");
    }

    @Override
    public void enterVariableDeclarator(ScriptParser.VariableDeclaratorContext ctx) {
        print(ctx, "enterVariableDeclarator");
    }

    @Override
    public void enterVariableDeclaratorId(ScriptParser.VariableDeclaratorIdContext ctx) {
        print(ctx, "enterVariableDeclaratorId");
    }

    @Override
    public void enterVariableInitializer(ScriptParser.VariableInitializerContext ctx) {
        print(ctx, "enterVariableInitializer");
    }

    @Override
    public void enterArrayInitializer(ScriptParser.ArrayInitializerContext ctx) {
        print(ctx, "enterArrayInitializer");
    }

    @Override
    public void enterLiteral(ScriptParser.LiteralContext ctx) {
        print(ctx, "enterLiteral");
    }


    @Override
    public void enterStatement(ScriptParser.StatementContext ctx) {
        print(ctx, "enterStatement");
    }


    @Override
    public void enterForControl(ScriptParser.ForControlContext ctx) {
        print(ctx, "enterForControl");
    }

    @Override
    public void enterForInit(ScriptParser.ForInitContext ctx) {
        print(ctx, "enterForInit");
    }

    @Override
    public void enterParExpression(ScriptParser.ParExpressionContext ctx) {
        print(ctx, "enterParExpression");
    }

    @Override
    public void enterExpressionList(ScriptParser.ExpressionListContext ctx) {
        print(ctx, "enterExpressionList");
    }

    @Override
    public void enterFunctionCall(ScriptParser.FunctionCallContext ctx) {
        print(ctx, "enterFunctionCall");
    }

    @Override
    public void enterExpression(ScriptParser.ExpressionContext ctx) {
        print(ctx, "enterExpression");
    }

    @Override
    public void enterPrimary(ScriptParser.PrimaryContext ctx) {
        print(ctx, "enterPrimary");
    }


    @Override
    public void enterName(ScriptParser.NameContext ctx) {
        print(ctx, "enterName");
    }

    @Override
    public void enterJsonInitializer(ScriptParser.JsonInitializerContext ctx) {
        print(ctx, "enterJsonInitializer");
    }

    @Override
    public void enterJsonArr(ScriptParser.JsonArrContext ctx) {
        print(ctx, "enterJsonArr");
    }

    @Override
    public void enterJsonObj(ScriptParser.JsonObjContext ctx) {
        print(ctx, "enterJsonObj");
    }

    @Override
    public void enterJsonPair(ScriptParser.JsonPairContext ctx) {
        print(ctx, "enterJsonPair");
    }

    @Override
    public void enterJsonValue(ScriptParser.JsonValueContext ctx) {
        print(ctx, "enterJsonValue");
    }
}
